﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using DTO;


namespace DAO
{
    public class LoaiSimDAO
    {
		public static List<LoaiSimDTO> DanhSachLoaiSim()
        {
            //usp_DanhSachLoaiSim	@MaSanPham int           
            DataTable dataTable = DataProvider.ExecuteReader("usp_DanhSachLoaiSim");
            List<LoaiSimDTO> lstloaiSimDTO = new List<LoaiSimDTO>();
            if (dataTable.Rows.Count > 0)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    LoaiSimDTO loaiSimDTO = new LoaiSimDTO();
                    loaiSimDTO.MaLoaiSim = int.Parse(dataRow["MaLoaiSim"].ToString());
                    loaiSimDTO.TenLoaiSim = dataRow["TenLoaiSim"].ToString();
                    lstloaiSimDTO.Add(loaiSimDTO);
                }
            }
            else
            {
                lstloaiSimDTO = null;
            }
            return lstloaiSimDTO;
        }
    }
}
